package cn.livingCloud.service;

import cn.livingCloud.dto.*;
import cn.livingCloud.entity.user.UserAccount;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.subject.PrincipalCollection;

import java.util.List;

/**
 * Created by 唐旭 on 2015/12/2.
 */
public interface UserAccountService {
    UserAccount getUserAccountByUserName(String username);

    AuthenticationInfo login(String username, String password);

    void getUserAccountList(UserAccountListDto userAccountListDto);

    /**
     * 更新状态方法
     *
     * @param uuid  账户的uuid
     * @param state 前端传入的状态     true:执行启用,false:执行禁用
     */
    UserAccountDto updateState(String uuid, boolean state);

    String updateAccount(UserAccountFormDto userAccountFormDto);

    UserAccountFormDto loadUserAccount(UserAccountFormDto formDto);

    void deleteAccount(String uuid);

    void updatePassword(AccountChangePasswordDto accountDto);

    AccountChangePasswordDto findUserAccountDtoByUuid(String uuid);

    void changeSelfPwd(ChangePasswordDto dto);

    boolean checkPassword(String oldPassword);

    /**
     * 检查该账号是否存在
     *
     * @param username 用户名
     * @return true:存在用户,false:不存在用户
     */
    boolean check(String username);

    List<UserDto> searchUserList(String key);

    AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals
            , SimpleAuthorizationInfo info);

    AuthenticationInfo loginMember(String memberCode);
}
